package com.byapp.fast.common.utils;

import com.byapp.fast.common.enums.PlayIdEnum;
import com.byapp.fast.common.enums.ResultEnum;
import com.byapp.fast.common.exception.BYException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PlayIdUtils {

    public static String[] getPlayItems(String playId) {
        PlayIdEnum playIdEnum = EnumUtils.getByCode(Integer.parseInt(playId), PlayIdEnum.class);
        if (playIdEnum == null) {
            log.error("Can not find playIdEnum By playId:{}", playId);
            throw new BYException(ResultEnum.ILLEGAL_PARAM);
        }

        return playIdEnum.getPlay().split("-");
    }

    public static String[] getTypeItems(String playId) {
        PlayIdEnum playIdEnum = EnumUtils.getByCode(Integer.parseInt(playId), PlayIdEnum.class);
        if (playIdEnum == null) {
            log.error("Can not find playIdEnum By playId:{}", playId);
            throw new BYException(ResultEnum.ILLEGAL_PARAM);
        }

        return playIdEnum.getType().split("-");
    }
}
